/*
 * @Author: Wanko
 * @Date: 2024-04-04 18:27:53
 * @LastEditors: Wanko
 * @LastEditTime: 2024-06-30 13:53:44
 * @Description:
 */
const router = new (require('@koa/router'))({ prefix: '/users' })

const {
  find,
  findById,
  create,
  update,
  del,
  login,
  refresh,
  likes,
  cards,
  resetpwd,
  collections
} = require('../controllers/users.js')
const { auth, authRefresh } = require('../middleware/auth.js')
router.get('/', find)
router.get('/:id', findById)
router.post('/', create, login)
router.put('/:id', auth, update)
router.del('/:id', auth, del)
router.post('/login', login)
router.post('/refresh', authRefresh, refresh)

router.post('/resetpwd', auth, resetpwd)

// 用户的喜欢卡片列表
router.get('/:id/likes', auth, likes)


// 用户的收藏列表
router.get('/:id/collections', auth, collections)


// 用户的卡片列表
router.get('/:id/cards', auth, cards)







module.exports = router
